//
//  GoldedVPNChangePwdVC.m
//  QLadder
//
//  Created by xiongguobing on 2019/8/13.
//  Copyright © 2019 qding. All rights reserved.
//

#import "GoldedVPNChangePwdVC.h"

@interface GoldedVPNChangePwdVC ()
@property (weak, nonatomic) IBOutlet UITextField *pwdTF;
@property (weak, nonatomic) IBOutlet UITextField *oldPwdTF;

@end

@implementation GoldedVPNChangePwdVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (IBAction)changePwdButtonClicked:(id)sender
{
    if (!ValidStr(self.oldPwdTF.text)) {
        kShowWithString(@"请输入旧密码");
        return;
    }
    if (!ValidStr(self.pwdTF.text)) {
        kShowWithString(@"请输入新密码");
        return;
    }
    kDismissKeyboard;
    NSString * userName = [kUserDefaults objectForKey:kUserAccount];
    [kNetworkUtil postWithModuleURLStr:modifyPwd parameters:@{@"oldPassword" : self.oldPwdTF.text, @"passWord" : self.pwdTF.text, @"userName" : userName} success:^(id response) {
        if ([[response objectForKey:@"code"] integerValue] == 200) {
            kShowWithString(response[@"message"]);
            [self.navigationController popViewControllerAnimated:YES];
        }
    } failure:nil withHud:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
